Skip to content

feat: add GradeEventContextEnricher pipeline step for grade analytics#2543

Open
pwnage101 wants to merge 2 commits into
masterfrom
pwnage101/ENT-11563
Open

feat: add GradeEventContextEnricher pipeline step for grade analytics#2543
pwnage101 wants to merge 2 commits into
masterfrom
pwnage101/ENT-11563

Conversation

@pwnage101
Copy link
Copy Markdown
Contributor

@pwnage101 pwnage101 commented Mar 4, 2026

Introduces enterprise/filters/grades.py with GradeEventContextEnricher, a PipelineStep for the org.openedx.learning.grade.context.requested.v1 filter that enriches grade analytics event context with the learner's enterprise UUID. Adds openedx-filters as a dependency and unit tests covering both enrichment and no-op branches.

ENT-11563

You can see it enriching the payload with the enterprise uuid correctly when fired directly
Screenshot 2026-05-18 at 8 29 18 PM

And in the COURSE_GRADE_PASSED_FIRST_TIME event sender also has the enterprise uuid information
Screenshot 2026-05-18 at 8 31 56 PM

Also tested with a user that doesn't have any enterprise associations, just prints enterprise uuid empty
Screenshot 2026-05-18 at 8 33 45 PM

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com


Blocked by:

Blocks:

Copy link
Copy Markdown
Contributor Author

@pwnage101 pwnage101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from these changes, please also remember to bump the version of edx-enterprise.

Apologies if this wasn't clear, but these draft claude-generated PRs were meant to offer guidance and direction, not to be ready to go as-is.

Comment thread enterprise/filters/grades.py Outdated
Comment thread enterprise/filters/grades.py Outdated
Comment thread enterprise/filters/grades.py Outdated
Comment thread enterprise/filters/grades.py Outdated
Comment thread enterprise/filters/grades.py Outdated
Comment thread requirements/test.txt Outdated
Comment thread enterprise/filters/grades.py Outdated
Comment thread tests/filters/test_grades.py Outdated
Comment thread tests/filters/test_grades.py
@kiram15 kiram15 force-pushed the pwnage101/ENT-11563 branch 5 times, most recently from ef579be to a6e0632 Compare May 13, 2026 22:03
@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.05%. Comparing base (2216a75) to head (ce68c0d).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2543   +/-   ##
=======================================
  Coverage   86.04%   86.05%           
=======================================
  Files         250      251    +1     
  Lines       16707    16718   +11     
  Branches     1657     1658    +1     
=======================================
+ Hits        14376    14387   +11     
  Misses       1997     1997           
  Partials      334      334           
Flag Coverage Δ
unittests 86.05% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kiram15 kiram15 force-pushed the pwnage101/ENT-11563 branch from a6e0632 to de18e6a Compare May 13, 2026 22:20
@kiram15 kiram15 marked this pull request as ready for review May 13, 2026 22:28
Comment thread enterprise/filters/grades.py
@kiram15 kiram15 force-pushed the pwnage101/ENT-11563 branch from de18e6a to d0ab934 Compare May 14, 2026 21:57
Copy link
Copy Markdown
Contributor Author

@pwnage101 pwnage101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, this PR and all future ones introducing a new filter will need to install the filter via enterprise/settings/common.py

@kiram15 kiram15 force-pushed the pwnage101/ENT-11563 branch 2 times, most recently from 7237868 to 8f926f3 Compare May 15, 2026 19:41
Copy link
Copy Markdown
Contributor Author

@pwnage101 pwnage101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM assuming you add the log line.

"course_id": <unchanged>,
}
"""
uuids = EnterpriseCourseEnrollment.get_enterprise_uuids_with_user_and_course(user_id, course_id)
Copy link
Copy Markdown
Contributor Author

@pwnage101 pwnage101 May 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please start this pipeline step with a log line to mirror all the other enterprise pipeline steps and improve stage/prod testing experience. Examples:

Be sure to not log PII. In this case, probably just the user_id and course_id are sufficient (exclude the context to keep log size down).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants